/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package TableView;

import data.Designationweightage;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author ChiHieu
 */
public class DesignationWeightageTable extends AbstractTableModel {

	private List<Designationweightage> desw;

	public DesignationWeightageTable() {
		this(new ArrayList<Designationweightage>());
	}

	public DesignationWeightageTable(List<Designationweightage> desw) {
		this.desw = desw;
	}

	@Override
	public int getRowCount() {
		return desw.size();
	}

	@Override
	public int getColumnCount() {
		return 3;
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Object value = null;
		Designationweightage desw_tmp = desw.get(rowIndex);
		switch (columnIndex) {
			case 0: {
				value = desw_tmp.getDesignation().getDesignationid();
				break;
			}
			case 1: {
				value = desw_tmp.getDepartments().getDeptname();
				break;
			}
			case 2: {
				value = desw_tmp.getWeightage();
				break;
			}
		}
		return value;
	}

	@Override
	public String getColumnName(int column) {
		String value = "";
		switch (column) {
			case 0: {
				value = "DESIGNATIONID";
				break;
			}
			case 1: {
				value = "DEPTNO";
				break;
			}
			case 2: {
				value = "WEIGHTAGE";
				break;
			}
		}
		return value;
	}
}
